<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
上传文件：<input type="file" id="upload">
</body>
<script src="https://g.csdnimg.cn/lib/jquery/1.12.4/jquery.min.js" ></script>
<script>
    $(function(){
        $("#upload").change(function(e){
            var data = new FormData();
            data.append("uploadFile",$(this)[0].files[0])
            $.ajax({
                url:'/api/uploadFile',
                type:'post',
                dataType:'json',
                data:data,
                processData:false,
                contentType:false,
                success:function(data){
                    console.log(data)
                }
            })
            ;

        })
    })
</script>
</html>